package com.example.mangroves.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.mangroves.entity.InfraredData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface InfraredDataMapper extends BaseMapper<InfraredData> {

    // 插入红外数据并返回自增ID（如果配置了自增ID）
    // MyBatis-Plus 默认会处理自增ID，无需显式定义

    // 获取最后一个红外数据的ID
    @Select("SELECT MAX(id) FROM infrareddata")
    Long selectLastId();

    // 根据ID获取红外数据
    @Select("SELECT * FROM infrareddata WHERE id = #{id}")
    InfraredData selectById(Long id);


}
